<link href="__PUBLIC__/admin/css/layout.css" rel="stylesheet" type="text/css" />
<link href="__PUBLIC__/js/pagination/pagination.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="__PUBLIC__/js/jquery.js"></script>
<link href="../Public/css/purview.css" rel="stylesheet" type="text/css" />
<div id="container">
<div class="tab">
	<ul>
		<li><a href="{:U('portal/Channel/admin')}">频道管理</a></li>
		<li><a href="{:U('portal/Channel/add')}">增加频道</a></li>
		<li><a class="on" href="{:U('portal/Purview/index')}">权限管理</a></li>
        <li><a href="{:U('portal/Channel/temp')}">模板管理</a></li>
	</ul>
</div>	
 <form action="{:U('portal/Purview/doAdd')}" method="post" onsubmit="return checkAdd()">
<table class="tableborder" width="100%">
<tr>
		  <th colspan="2" class="header">添加管理员</th>
		</tr>
      <tr class="label cell">
        <td>说明</td>
        <td>数据</td>
      </tr>
      <tr class="cell">
        <td class="altbg1">管理员ID/域账号：</td>
        <td class="altbg2"><input type="text" style="width:250px;" class="in_put mr5" name="user" id="user" /></td>
      </tr>
      <tr class="cell">
        <td class="altbg1">所属频道：</td>
        <td class="altbg2">  <select name="channelId" id="channelId" class="in_put_01">
                        <volist name='channel' id='vo'>
                            <option value="{$vo.id}">{$vo.title}</option>
                        </volist>
                    </select> </td>
      </tr>
      <tr>
        <td colspan="2" class="footer"><input type="submit" name="botton2" class="btn_sea" value="添加管理员"/></td>
      </tr>
    </table>
 </form>
  <form action="{:U('portal/Purview/doEidt')}" method="post">
 <table class="tableborder" border="0" cellpadding="0" cellspacing="0" width="100%">
    	<tr>
        	<th class="header" colspan="10">添加/修改权限</th>
        </tr>
        <tr class="label cell">
        	<th><a title="按管理员" href="{:U('portal/Purview/index',array('p'=>$_GET[p],'order'=>'uid','sort'=>$sort))}">管理员</a></th>
            <th><a title="按所属频道" href="{:U('portal/Purview/index',array('p'=>$_GET[p],'order'=>'channelId','sort'=>$sort))}">所属频道</a></th>
            <th>管理</th>
        </tr>    <volist name='list.data' id='vo'>
               <tr class="cell" height="25">
            	<td>{$vo.uid|getUserName}</td>
            	<td>{$vo.channelId|getChannelTitle}</td>
                <td><a href="javascript:void(0)" onclick="delPurview({$vo.id});return false;">删除</a></td>
            </tr>
          </volist>
    </table>
    </form>
</div>
<script type="text/javascript">
function checkAdd(){
	var user = $('#user').val();
	if(user==''){
		$.tbox.no('请填写管理员ID/域账号');
		return false;
	}
	
	var channelId = $('#channelId').val();
	if(channelId==''){
		$.tbox.no('请选择所属频道');
		return false;
	}	
	
	$('#channelId').val(channelId);
	
	return true;
}

function delPurview(id){
	if(confirm("确认删除？")){
		var url = "{:U('portal/Purview/doDel')}&id="+id;
		window.location.href = url;
	}	
}

$(function(){
   var channelId = "{:$_GET['channelId']}";

   if(channelId!='' && channelId!='undefined'){
	   $("#channelId").val(channelId);	  
   }	 
});
</script>